﻿//---------------------------------------------------------------------
// <copyright file="RecipeController.cs" company="Travis Merkel">
//      Copyright (c) Travis Merkel. All Rights Reserved.
//      Information Contained Herein is Proprietary and Confidential.
// </copyright>
// <summary>
// Controller to manage Recipe interactions. 
// </summary>
// <author>tmerkel</author>
//---------------------------------------------------------------------
namespace RecipeBook.UI.Web.Controllers
{
	using System;
	using System.Collections.Generic;
	using System.Linq;
	using System.Web;
	using System.Web.Mvc;
	using System.Web.Mvc.Ajax;
    using RecipeBook.Business.EntityFramework;

    /// <summary>
    /// Controller to manage Recipe interactions.
	/// </summary>
    public class RecipeController : Controller
    {
        private IRecipeRepository repository;

        #region Constructor
        /// <summary>
        /// Creates a new instance of the RecipeController class.
        /// </summary>
        public RecipeController()
        {
            this.repository = new RecipeRepository();
        }
        #endregion

        /// <summary>
		/// 
		/// </summary>
        public ActionResult Index()
        {
            IEnumerable<Recipe> allRecipes = this.repository.GetAll();

            return this.View(allRecipes);
        }

        /// <summary>
        /// 
        /// </summary>
        public ActionResult RecipeDetail()
        {
            return this.View();
        }

        /// <summary>
        /// 
        /// </summary>
        public ActionResult Add()
        {
            return this.View();
        }

        /// <summary>
        /// 
        /// </summary>
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Add(FormCollection collection)
        {
            try
            {
                return this.RedirectToAction("Index");
            }
            catch
            {
                return this.View();
            }
        }

        ///// <summary>
        ///// 
        ///// </summary>
        //public ActionResult Edit(int id)
        //{
        //    return this.View();
        //}

        ///// <summary>
        ///// 
        ///// </summary>
        //[AcceptVerbs(HttpVerbs.Post)]
        //public ActionResult Edit(int id, FormCollection collection)
        //{
        //    try
        //    {
        //        return this.RedirectToAction("Index");
        //    }
        //    catch
        //    {
        //        return this.View();
        //    }
        //}
    }
}
